#-*-coding:utf-8-*-
'''
This module will test the newcompress
'''
import random
class newtest:
    '''
    New test!
    '''
    def __init__(self):
        pass

    def GetTestMatrixData(self,testlen = 10000,rows = 256,cols = 256,width = 256):
        '''
        Get the test Matrix Data!
        '''
        content = [[[0 for i in range(width)]for j in range(cols)]for k in range(rows)]        #to save the datas.
        c = 0
        p = 0
        while c < testlen:
            i = random.randint(0,255)
            j = random.randint(0,255)
            k = random.randint(0,255)
            if content[i][j][k] == 0:
                content[i][j][k] = [self.GetMatrixPosStr(c)]
            else:
                content[i][j][k].append(self.GetMatrixPosStr(c))
            c += 1
        return content

    def GetContentEx(self,klenth = 2):
        '''
        Get the extra content!
        '''
        k = ''
        for i in range(klenth):
            k += chr(random.randint(0,255))
        return k

    def GetMatrixPosStr(self,loc):
        '''
        Convert the intorder into Matrix str order.
        '''
        if loc >= 65535:
            return False
        else:
            loc += 4
            k1 = chr(loc / 256)
            k2 = chr(loc % 256)
            return k1 + k2

